<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input type="button" value="新增学员" onclick="xinzeng()">
    <input type="button" value="显示学员信息" onclick="xianshi()">

    <p id="p"></p>


    <script>
        let sum = [];
        let p = document.getElementById("p");
        function xinzeng() {
            var name = prompt("请输入新增学员姓名：");
            sum.push(name);
        }
        function xianshi() {
            p.innerHTML = "共" + sum.length + "个学员，信息如下：" + '</br>';
            for(let i = 0; i < sum.length; i++) {
                p.innerHTML += sum[i] + '</br>';
            }
        } 
    </script>
</body>
</html>